﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AddressInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%: Html.Partial("Sidebar") %>
    <div id="main">
        <div class="main-block">
            <h2 class="title">
                <%:"Checkout".Localize() %></h2>
            <form id="checkout" action="<%= this.ViewData["CartLinks"].Bind("Checkout")  %>"
            method="post">
            <div class="main-block-content cart-content clearfix">
                <div class="order-progress">
                    <ul>
                        <li><a href="<%= this.ViewData["CartLinks"].Bind("Index")  %>">
                            <%:"Cart".Localize() %></a></li>
                        <li class="active"><a>
                            <%:"Address".Localize() %></a></li>
                        <li><a>
                            <%:"Shipping & Payment".Localize() %></a></li>
                        <li><a>
                            <%:"Confirm".Localize() %></a></li>
                    </ul>
                </div>
                <!-- shipping address -->
                <h5 class="title">
                    <%:"Shipping Address".Localize() %></h5>
                <div class="cart-block shipping">
                    <a href="javascript:void(0);" class="changeAddress" data="shipping_address">
                        <%:"Change Address".Localize() %></a>
                    <div class="shipping_address address-list dialog hide" style="height: 300px; width: 500px"
                        title="Address">
                        <table>
                            <tbody>
                                <% 
                                    foreach (object item in this.ViewBag.Addresses)
                                    {
                                %>
                                <tr>
                                    <th>
                                        <input type="radio" class="selector" name="selector" />
                                        <input type="hidden" class="binder" data-name="Country" value="<%: item.Bind("Country").Bind("CountryCode")%>" />
                                    </th>
                                    <td>
                                        <strong><span class="binder" data-name="FirstName">
                                            <%: item.Bind("FirstName") %></span> <span class="binder" data-name="LastName">
                                                <%: item.Bind("LastName")%></span></strong>
                                    </td>
                                    <td>
                                        <span class="binder" data-name="Address1">
                                            <%: item.Bind("Address1")%></span> <span class="binder" data-name="Address2">
                                                <%: item.Bind("Address2")%></span> <span class="binder" data-name="City">
                                                    <%: item.Bind("City")%></span> <span class="binder" data-name="State">
                                                        <%: item.Bind("State")%></span>
                                        <%: item.Bind("Country").Bind("CountryName")%>
                                        <span class="binder hide" data-name="Phone">
                                            <%: item.Bind("Phone")%></span> <span class="binder hide" data-name="Postcode">
                                                <%: item.Bind("Postcode")%></span>
                                    </td>
                                </tr>
                                <%
                                    } %>
                            </tbody>
                        </table>
                        <div class="buttons">
                            <a class="save_ShippingAddress button" href="javascript:void(0)"><span>
                                <%:"Change".Localize() %></span></a>
                        </div>
                    </div>
                    <div class="common-form" id="shipping">
                        <fieldset>
                            <p>
                                <label for="firstname">
                                    <span>*</span> 
                                    <%:"First name:".Localize() %></label>
                                <input type="text" id="Shipping_firstname" name="FirstName" class="firstname" value="<%= this.Model.Shipping.FirstName  %>" />
                            </p>
                            <p>
                                <label for="lastname">
                                    <span>*</span> 
                                    <%:"Last Name".Localize() %></label>
                                <input type="text" id="Shipping_lastname" name="LastName" class="lastname" value="<%= this.Model.Shipping.LastName  %>" />
                            </p>
                            <p>
                                <label for="telephone">
                                    <span>*</span> 
                                    <%:"Telephone".Localize() %></label>
                                <input type="text" id="Shipping_telephone" name="Phone" class="phone" value="<%= this.Model.Shipping.Phone  %>" />
                            </p>
                            <p>
                                <label for="address1">
                                    <span>*</span> 
                                    <%:"Address 1".Localize() %></label>
                                <input type="text" id="Shipping_address1" name="Address1" class="address1" value="<%= this.Model.Shipping.Address1  %>" />
                            </p>
                            <p>
                                <label for="address2">
                                    <%:"Address 2".Localize() %></label>
                                <input type="text" id="Shipping_address2" name="Address2" value="<%= this.Model.Shipping.Address2  %>" />
                            </p>
                            <p>
                                <label for="city">
                                    <span>*</span> 
                                    <%:"City".Localize() %></label>
                                <input type="text" id="Shipping_city" name="City" class="city" value="<%= this.Model.Shipping.City  %>" />
                            </p>
                            <p>
                                <label for="postcode">
                                    <span>*</span> 
                                    <%:"Postcode".Localize() %></label>
                                <input type="text" id="Shipping_postcode" name="Postcode" class="postcode" value="<%= this.Model.Shipping.Postcode  %>" />
                            </p>
                            <p>
                                <label for="country">
                                    <span>*</span> 
                                    <%:"Country".Localize() %></label>
                                <select id="Shipping_country" name="Country">
                                    <% foreach (object item in this.ViewBag.ShippingCountryItems)
                                       {
                                    %>
                                    <option value="<%= item.Bind("Item1")  %>" <%= (bool)item.Bind("Item3")?"selected=selected":"" %>>
                                        <%: item.Bind("Item2")  %></option>
                                    <%
                                       } %>
                                </select>
                            </p>
                            <p>
                                <label for="state">
                                    <%:"Region / State".Localize() %></label>
                                <input type="text" id="Shipping_region" name="State" value="<%= this.Model.Shipping.State  %>" />
                            </p>
                        </fieldset>
                    </div>
                </div>
                <!-- payment address -->
                <h5 class="title">
                    <%:"Payment Address".Localize() %></h5>
                <div class="cart-block">
                    <div class="cart-block payment">
                        <input type="checkbox" <%: this.Model.Payment.UseInvoiceAddress?"":"checked='checked'" %>
                            name="SameAsShippingAddress" id="SameAsShippingAddress" />
                        <label for="SameAsShippingAddress">
                            <%:"Same as Shipping address".Localize() %></label>
                        <a href="javascript:void(0);" class="changeAddress  <%: this.Model.Payment.UseInvoiceAddress?"":"hide" %>"
                            id="payment_changeAddress" data="payment_address">
                            <%:"Change address".Localize() %></a>
                        <div id="payment_address_main">
                            <div class="payment_address address-list dialog hide" style="height: 300px; width: 500px"
                                title="Address">
                                <table>
                                    <tbody>
                                        <% foreach (object item in this.ViewBag.Addresses)
                                           {
                                        %>
                                        <tr>
                                            <th>
                                                <input type="radio" class="selector" name="selector" />
                                                <input type="hidden" class="binder" data-name="InvoiceCountry" value="<%: item.Bind("Country").Bind("CountryCode")%>" />
                                            </th>
                                            <td>
                                                <strong><span class="binder" data-name="InvoiceFirstName">
                                                    <%: item.Bind("FirstName")%></span> <span class="binder" data-name="InvoiceLastName">
                                                        <%: item.Bind("LastName")%></span> </strong>
                                            </td>
                                            <td>
                                                <span class="binder" data-name="InvoiceAddress1">
                                                    <%: item.Bind("Address1")%></span> <span class="binder" data-name="InvoiceAddress2">
                                                        <%: item.Bind("Address2")%></span> <span class="binder" data-name="InvoiceCity">
                                                            <%: item.Bind("City")%></span> <span class="binder" data-name="InvoiceState">
                                                                <%: item.Bind("State")%></span>
                                                <%: item.Bind("Country").Bind("CountryName")%>
                                                <span class="binder hide" data-name="InvoicePostcode">
                                                    <%: item.Bind("Postcode")%></span> <span class="binder hide" data-name="InvoicePhone">
                                                        <%: item.Bind("Phone") %></span>
                                            </td>
                                        </tr>
                                        <% } %>
                                    </tbody>
                                </table>
                                <div class="buttons">
                                    <a class="save_paymentAddress button" href="javascript:void(0)"><span>
                                        <%:"Change".Localize() %></span></a>
                                </div>
                            </div>
                            <div class="common-form" id="payment">
                                <fieldset>
                                    <p>
                                        <label for="firstname">
                                            <span>*</span> 
                                            <%:"First name:".Localize() %></label>
                                        <input type="text" id="invoice_Firstname" data-equ="Shipping_firstname" class="firstname"
                                            name="InvoiceFirstName" value="<%= this.Model.Payment.InvoiceFirstName                    %>" />
                                    </p>
                                    <p>
                                        <label for="lastname">
                                            <span>*</span> 
                                            <%:"Last Name".Localize() %></label>
                                        <input type="text" id="invoice_Lastname" data-equ="Shipping_lastname" class="lastname"
                                            name="InvoiceLastName" value="<%= this.Model.Payment.InvoiceLastName %>" />
                                    </p>
                                    <p>
                                        <label for="telephone">
                                            <span>*</span> 
                                            <%:"Telephone".Localize() %></label>
                                        <input type="text" id="invoice_Telephone" data-equ="Shipping_telephone" class="phone"
                                            name="InvoicePhone" value="<%= this.Model.Payment.InvoicePhone %>" />
                                    </p>
                                    <p>
                                        <label for="address1">
                                            <span>*</span> 
                                            <%:"Address 1".Localize() %></label>
                                        <input type="text" id="invoice_Address1" data-equ="Shipping_address1" class="address1"
                                            name="InvoiceAddress1" value="<%= this.Model.Payment.InvoiceAddress1 %>" />
                                    </p>
                                    <p>
                                        <label for="address2">
                                            <%:" Address 2".Localize() %></label>
                                        <input type="text" id="invoice_Address2" data-equ="Shipping_address2" name="InvoiceAddress2"
                                            value="<%= this.Model.Payment.InvoiceAddress2 %>" />
                                    </p>
                                    <p>
                                        <label for="city">
                                            <span>*</span> 
                                            <%:"City".Localize() %></label>
                                        <input type="text" id="invoice_City" data-equ="Shipping_city" class="city" name="InvoiceCity"
                                            value="<%= this.Model.Payment.InvoiceCity                    %>" />
                                    </p>
                                    <p>
                                        <label for="postcode">
                                            <span>*</span> 
                                            <%:"Postcode".Localize() %></label>
                                        <input type="text" id="invoice_Postcode" data-equ="Shipping_postcode" class="postcode"
                                            name="InvoicePostcode" value="<%= this.Model.Payment.InvoicePostcode %>" />
                                    </p>
                                    <p>
                                        <label for="country">
                                            <span>*</span> 
                                            <%:"Country".Localize() %></label>
                                        <select id="invoice_InvoiceCountry" data-equ="Shipping_country" name="InvoiceCountry">
                                            <% foreach (object item in this.ViewBag.PaymentCountryItems)
                                               { %>
                                            <option value="<%= item.Bind("Item1") %>" <%= (bool)item.Bind("Item3")?"selected=selected":""                    %>>
                                                <%: item.Bind("Item2") %></option>
                                            <% } %>
                                        </select>
                                    </p>
                                    <p>
                                        <label for="state">
                                            <%:"Region / State".Localize() %></label>
                                        <input type="text" id="invoice_Region" data-equ="Shipping_region" name="InvoiceState"
                                            value="<%= this.Model.Payment.InvoiceState %>" />
                                    </p>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="buttons">
                    <a class="button left" href="<%= this.ViewData["CartLinks"].Bind("Index")
                %>"><span>
                    <%:"« Back to Cart".Localize() %></span></a>
                    <button type="submit" class="button right">
                        <em><span>
                            <%:"Continue »".Localize() %></span> </em>
                    </button>
                </div>
            </div>
            </form>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="JSContent" runat="server">
    <script type="text/javascript" src="../../Scripts/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.validate.rules.js"></script>
    <script type="text/javascript" src="../../Scripts/Views/Cart/cart.address.js"></script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Breadcrumb" runat="server">
</asp:Content>
